package in.indijava.scjp5questions;

import java.io.*; 

public class Serializations {
	public static void main(String[] args) {
		CardPlayer c1 = new CardPlayer();
		try {
//			FileOutputStream fos = new FileOutputStream("play.txt");
//			ObjectOutputStream os = new ObjectOutputStream(fos);
//			os.writeObject(c1);
//			os.close();
			System.out.println();
			FileInputStream fis = new FileInputStream("play.txt");
			ObjectInputStream is = new ObjectInputStream(fis);
			CardPlayer c2 = (CardPlayer) is.readObject();
			is.close();
			System.out.println(c2.toString());
		} catch (Exception x) {
		}
	}
}

class Human implements Serializable{
	public Human() {
		System.out.print("h");
	}
}

class Player extends Human{
	Player() {
		System.out.print("p");
	}
}

class CardPlayer extends Player implements Serializable {
	CardPlayer() {
		System.out.print("c");
	}
	
	@Override
	public String toString() {
		return "I>" + super.toString();
	}
}